export default {
  date(x: string) {
    var d1 = [
      "星期天",
      "星期一",
      "星期二",
      "星期三",
      "星期四",
      "星期五",
      "星期六",
    ];
    let data = new Date();
    let ye: number | string = data.getFullYear();
    let mo: number | string = data.getMonth() + 1;
    let da: number | string = data.getDate();
    let d: number | string = d1[data.getDay()] + " ";
    let h: number | string = data.getHours();
    h = h < 10 ? "0" + h : h;
    let m: number | string = data.getMinutes();
    m = m < 10 ? "0" + m : m;
    let s: number | string = data.getSeconds();
    s = s < 10 ? "0" + s : s;
    if (x === 'all') {
      return ye + "-" + mo + "-" + da + '_' + h + '_' + m + '_' + s
    }
    if (x === "date") {
      return ye + "-" + mo + "-" + da;
    } else if (x === "time") {
      return h + ":" + m + ":" + s;
    } else {
      return ye + "年" + mo + "月" + da + "日" + d + h + ":" + m + ":" + s;
    }
  }
}